import {request} from "./request";

//请求详情页数据
export function getDetail(iid) {
    return request({
        url: '/detail/',
        params: {
            iid
        }
    })


}

//请求推荐数据
export function getRecommend() {
    return request({
        url: '/recommend/',
    })


}

//糅合商品信息
export class Goods {
    //构造一个新的对象来接收所想要的杂乱信息
    constructor(itemInfo, colums, services) {
        this.title = itemInfo.title
        this.desc = itemInfo.desc
        this.newPrice = itemInfo.price
        this.oldPrice = itemInfo.oldPrice
        this.discount = itemInfo.discountDesc
        this.colums = colums
        this.services = services
        this.realPrice = itemInfo.lowNowPrice

    }
}

//糅合店铺信息
export class Shop {
    constructor(shopInfo){
        this.logo = shopInfo.shopLogo
        this.name = shopInfo.name
        this.fans = shopInfo.cFans
        this.sells = shopInfo.cSells
        this.score = shopInfo.score
        this.goodsCount = shopInfo.cGoods
    }
}
//获取商店参数信息
export class GoodsParam{
    constructor(info, rule){
        //商品最好可能有展示的图片  进行判断
        this.image = info.images ? info.images[0] : '';
        this.infos = info.set;
        this.sizes = rule.tables
    }
}